package com.dianping.cat.home.utilization.entity;

import com.dianping.cat.home.utilization.BaseEntity;
import com.dianping.cat.home.utilization.IVisitor;
import java.util.LinkedHashMap;
import java.util.Map;






public class Domain
  extends BaseEntity<Domain>
{
  private String m_id;
  private int m_machineNumber;
  private String m_cmdbId;
/*  19 */   private Map<String, MachineState> m_machineStates = new LinkedHashMap();

/*  21 */   private Map<String, ApplicationState> m_applicationStates = new LinkedHashMap();





/*  27 */   public Domain(String id) { this.m_id = id; }




  public void accept(IVisitor visitor) { visitor.visitDomain(this); }


  public Domain addApplicationState(ApplicationState applicationState) {
    this.m_applicationStates.put(applicationState.getId(), applicationState);
/*  37 */     return this;
  }

  public Domain addMachineState(MachineState machineState) {
/*  41 */     this.m_machineStates.put(machineState.getId(), machineState);
/*  42 */     return this;
  }


  public boolean equals(Object obj) {
/*  47 */     if (obj instanceof Domain) {
/*  48 */       Domain _o = (Domain)obj;

/*  50 */       if (!equals(getId(), _o.getId())) {
/*  51 */         return false;
      }

/*  54 */       return true;
    }

/*  57 */     return false;
  }


/*  61 */   public ApplicationState findApplicationState(String id) { return (ApplicationState)this.m_applicationStates.get(id); }



/*  65 */   public MachineState findMachineState(String id) { return (MachineState)this.m_machineStates.get(id); }


  public ApplicationState findOrCreateApplicationState(String id) {
/*  69 */     ApplicationState applicationState = (ApplicationState)this.m_applicationStates.get(id);

/*  71 */     if (applicationState == null) {
/*  72 */       synchronized (this.m_applicationStates) {
/*  73 */         applicationState = (ApplicationState)this.m_applicationStates.get(id);

/*  75 */         if (applicationState == null) {
/*  76 */           applicationState = new ApplicationState(id);
/*  77 */           this.m_applicationStates.put(id, applicationState);
        }
      }
    }

/*  82 */     return applicationState;
  }

  public MachineState findOrCreateMachineState(String id) {
/*  86 */     MachineState machineState = (MachineState)this.m_machineStates.get(id);

/*  88 */     if (machineState == null) {
/*  89 */       synchronized (this.m_machineStates) {
/*  90 */         machineState = (MachineState)this.m_machineStates.get(id);

/*  92 */         if (machineState == null) {
/*  93 */           machineState = new MachineState(id);
/*  94 */           this.m_machineStates.put(id, machineState);
        }
      }
    }

/*  99 */     return machineState;
  }


/* 103 */   public Map<String, ApplicationState> getApplicationStates() { return this.m_applicationStates; }



/* 107 */   public String getCmdbId() { return this.m_cmdbId; }



/* 111 */   public String getId() { return this.m_id; }



/* 115 */   public int getMachineNumber() { return this.m_machineNumber; }



/* 119 */   public Map<String, MachineState> getMachineStates() { return this.m_machineStates; }



  public int hashCode() {
/* 124 */     int hash = 0;

/* 126 */     return hash * 31 + ((this.m_id == null) ? 0 : this.m_id.hashCode());
  }




  public void mergeAttributes(Domain other) {
/* 133 */     assertAttributeEquals(other, "domain", "id", this.m_id, other.getId());

/* 135 */     this.m_machineNumber = other.getMachineNumber();

/* 137 */     if (other.getCmdbId() != null) {
/* 138 */       this.m_cmdbId = other.getCmdbId();
    }
  }


/* 143 */   public ApplicationState removeApplicationState(String id) { return (ApplicationState)this.m_applicationStates.remove(id); }



/* 147 */   public MachineState removeMachineState(String id) { return (MachineState)this.m_machineStates.remove(id); }


  public Domain setCmdbId(String cmdbId) {
/* 151 */     this.m_cmdbId = cmdbId;
/* 152 */     return this;
  }

  public Domain setId(String id) {
/* 156 */     this.m_id = id;
/* 157 */     return this;
  }

  public Domain setMachineNumber(int machineNumber) {
/* 161 */     this.m_machineNumber = machineNumber;
/* 162 */     return this;
  }

  public Domain() {}
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/classes/!/com/dianping/cat/home/utilization/entity/Domain.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */